$(document).ready(function() {
    $("#start_button").click(function() {
        $.get("http://127.0.0.1:8000/find_user/", function(data) {
            if(data == "no_user_exists") {
                $("#find_user_info").html("has not find");
                setInterval(function findUser() {
                    $.get("http://127.0.0.1:8000/find/", function(data) {
                        if (data == "Success") {
                            self.location = "/game/";
                        }
                    });
                }, 1000);
            }
            else if (data == "Success") {
                self.location = "/game/";
            }
        });
    });
});